/**
 * 
 */
package com.tompai.datagather.shedule;

import java.time.LocalTime;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.tompai.datagather.dao.TwitterAcountSeedsMapper;
import com.tompai.datagather.dao.TwitterAcountsMapper;

@Component
public class ScheduleRunner {
	
	//public static final Logger LOG = LoggerFactory.getLogger(ScheduleRunner.class);
	
	@Autowired
    private TwitterAcountsMapper acountsMapper;
	private TwitterAcountSeedsMapper seedsMapper;
	
	//每隔15秒執行一次//
	@Scheduled(fixedDelay = 3 * 1000)
	//@Scope("Prototype")
	public void calCounts() {
		//SqlSession session=MybatisUtil.getSession();
		//TwitterAcountsMapper acountsMapper = session.getMapper(TwitterAcountsMapper.class);
		int accountNumber = acountsMapper.selectAccountNumber();
		int seedAcount=seedsMapper.selectSeedAcount("BeijingPalmer");
		//LOG.info(Thread.currentThread() + ", calCounts@" + LocalTime.now() + "; account numbers:" + accountNumber +",seed:"+seedAcount);
		System.out.println(Thread.currentThread() + ", calCounts@" + LocalTime.now() + "; account numbers:" + accountNumber +",seed:"+seedAcount);
		
		//session.flushStatements();
		//session.clearCache();
		//session.commit();
	}
}